package com.itheima.HomeWork;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

public class Demo03 {
    public static void main(String[] args) {
        String day="2020-12-12 12:23:12";
        DateTimeFormatter dateTimeFormatter=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime  l1=LocalDateTime.parse(day,dateTimeFormatter);
//        LocalTime l2= LocalTime.parse(day,dateTimeFormatter);
        System.out.println(l1);

        LocalDateTime l2=l1.plusYears(1);
        LocalDateTime l3 = l2.plusMonths(2);
        LocalDateTime l4=l3.plusHours(4);
        LocalDateTime l5=l4.plusMinutes(8);
        LocalDateTime l6=l5.plusSeconds(45);
        System.out.println(l6);
        dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH小时mm分钟ss秒");
        System.out.println(l6.format(dateTimeFormatter));
        System.out.println(dateTimeFormatter.format(l6));

    }
}
